"""
BreakerPlayer.py

Author: Zach Epolito
Date: 9-21-08
"""

from BreakerStrategy import BreakerStrategy
from HumanBreakerStrategy import HumanBreakerStrategy
from RandCompBreakerStrategy import RandCompBreakerStrategy

"""Imitates a Breaker player and has a reference to
   the different strategies.
"""
class BreakerPlayer(object):
    #types of strategies
    HUMAN = 0
    RANDOM_COMPUTER = 1

    """Constructor. Sets which strategy is being used.
       Sets wait time.
    """
    def __init__(self, stratType, waitTime):
        self.waitTime = waitTime
        self.setStrat(stratType)
        
    """Passes the GUI, controller functor and waitTime to
       the correct strategy.
    """
    def getMove(self, contFunctor, GUI):
        self.strat.strategy(contFunctor, GUI, self.waitTime)

    """Sets the strategy
    """
    def setStrat(self, stratType):
        if (stratType == self.HUMAN):
            self.strat = HumanBreakerStrategy()
        elif (stratType == self.RANDOM_COMPUTER):
            self.strat = RandCompBreakerStrategy()

    """Sets the wait time for computer turns
    """
    def setWaitTime(self, waitTime):
        self.waitTime = waitTime
